package com.trembear.carclient.config;

import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

/**
 * @author Junwei.Xiong
 * @description:
 * @create 2018-07-16 17:58
 */
@Configuration
@ImportResource(locations={"classpath:applicationContext.xml"})
public class MyConfig {
    @Bean
    public DataSource dataSource() {
        PoolProperties poolProperties = new PoolProperties();
        poolProperties.setMaxActive(105);
        poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
        poolProperties.setName("ucarabs");
        poolProperties.setPassword("developer1015");
        poolProperties.setUrl("jdbc:mysql://10.104.20.123:3306/ucar_abs?useUnicode=true&amp;characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull" );
       poolProperties.setUsername("developer");
        return new DataSource(poolProperties);
    }

}
